@var isAdd = shiro.hasPermission("sys.menu.add");
@var isEdit = shiro.hasPermission("sys.menu.edit");
@var isDel = shiro.hasPermission("sys.menu.delete");
@var content = {
<style>
    .table-no-left-right-border thead tr th{
        text-align: left;
    }
    .table-no-left-right-border thead tr td{
         text-align: left;
     }
</style>
<div class="panel panel-info">
    <div class="panel-body">
        <div id="menuTable"></div>
        <script type="text/javascript">
            var table = $('#menuTable').bootstrapTableExtension({
                type:'tree',
                dataUrl: '/sys/menu/list',//数据加载地址
                addUrl: '/sys/menu/add',//添加地址
                editUrl: '/sys/menu/edit',//菜单编辑地址
                delUrl: '/sys/menu/delete',//删除数据地址
                isAddBtnIsShow: '${isAdd}' === 'true',
                addBtnText: '添加',
                isEditBtnIsShow: '${isEdit}' === 'true',
                editBtnText: '编辑',
                isDeleteBtnIsShow: '${isDel}' === 'true',
                deleteBtnText: '删除',
                toolbar:'menuToolbar',
                columns:[
                    {field: 'selectItem', checkbox: true},
                    {
                        field: 'name', title: '名称',
                        formatter: function (arg, obj) {
                            if ('${isEdit}' === 'true') {
                                return '<a href="javascript:void(0);" onclick="table.bootstrapTableExtension(\'edit\',\'/sys/menu/edit/'+obj.id+'\')">' + arg + '</a>';
                            } else {
                                return arg;
                            }
                        }
                    },
                    {
                        field: 'isMenu', title: '是否菜单', formatter: function (arg) {
                            if (arg === 0) {
                                return '否';
                            } else if (arg === 1) {
                                return '是';
                            } else {
                                return '其他';
                            }
                        }
                    },
                    {
                        field: 'icon', title: '图标', formatter: function (arg) {
                            return "<i class='" + arg + "'></i>";
                        }
                    },
                    {field: 'moduleName', title: '模块名称'},
                    {field: 'actionName', title: '控制器名称'},
                    {field: 'functionName', title: '方法名称'},
                    {
                        field: 'createTime', title: '创建时间', align: 'center', sortable: false,
                        formatter: function (arg) {
                            return arg.slice(0, 10) + " " + arg.slice(11, 20);
                        }
                    },
                    {
                        field: 'updateTime', title: '修改时间', align: 'center',
                        formatter: function (arg) {
                            return arg.slice(0, 10) + " " + arg.slice(11, 20);
                        }
                    },
                    {
                        field: 'deleteTime', title: '是否已删除', align: 'center', formatter: function (arg) {
                            if (arg == null) {
                                return '否';
                            }
                            return '是，删除时间：' + arg;
                        },
                    }, {field: 'sort', title: '排序', align: 'center'},
                ],
                otherInputs: [
                    {
                        isShow: true,
                        classes: 'form-control',
                        name: 'search',
                        id: 'search',
                        placeholder: '请输入文字并回车查询'
                    }
                ],
            })
        </script>
    </div>
</div>
@};
@include('../../layout/_open_content.html',{content:content}){}